package lab02.test21;

import java.io.IOException;
import java.util.Scanner;

public class Test21 {
    public static void main(String[] args) throws IOException {
        System.out.println("请输入你的字符串：");
        Scanner sc=new Scanner(System.in);
        String string=sc.next();
        System.out.println("请输入您要统计的字符：");

        char ch=(char)System.in.read();

        int count=0;
        for (int i=0;i<string.length();){
            char tmp=string.charAt(i++);
            if (tmp==ch){
                count +=1;
            }
        }
        System.out.println("该字符的频率为："+count);
    }
}
